#include<iostream>

using namespace std;

#define root 1,n,1
#define lson l,m,rt<<1
#define rson m+1,r,rt<<1|1

void update(int rt)
{
	z[rt] = max(z[rt<<1],z[rt<<1|1]); 
}

void build(int l,int r,int rt)
{
	if (l==r)
	{
		z[rt] = y[l];
		return;
	}
	int m=(l+r)>>1;
	build(lson);
	build(rson);
	update(rt);
}

void modify(int l,int r,int rt,int p,int v)
{
	if (l==r)
	{
		z[rt] += v;
		return;
	}
	int m=(l+r)>>1;
	if (p<=m) modify(lson,p,v);
	else modify(rson,p,v);
	update(rt);
}

int query(int l,int r,int rt,int nowl,int nowr)
{
	if (nowl<=l && r<=nowr) return z[rt];
	int m=(l+r)>>1;
	if (nowl<=m)
	{
		if (m<nowr) return max(query(lson,nowl,nowr),query(rson,nowl,nowr));
		else return query(lson,nowl,nowr);
	}
	else return query(rson,nowl,nowr);
}

int main()
{
	cin >> n;
	for (int a=1;a<=n;a++)
		cin >> y[a];
		
	build(root);
	
	cin >> m;
	for (int a=1;a<=m;a++)
	{
		string s;
		cin >> s;
		if (s == "xiugai")
		{
			int p,v;
			cin >> p >> v;
			modify(root,p,v);
		}
		else
		{
			int l,r;
			cin >> l >> r;
			cout << query(root,l,r) << endl;
		}
	}
	
	
	
}
